/****
This function picks a cluster mass from a CMF that goes as M^-2 with min mass
of 20 and maximum mass set by the global varaible max_cluster_mass

Written by MF&RD, Apr 2010
Add parameters, July 2010 (MF)
*****/

extern double max_cluster_mass;
extern double slope_cmf;         
extern double min_cluster_mass;  

double cluster_draw(gsl_rng * rand) {

  double  mmin, mmax, gamma;

  
  mmin =  min_cluster_mass;
  mmax =  max_cluster_mass;
  gamma = slope_cmf;
  
  // Now draw from a power-law in m and return
  return(ranpowerlaw(mmin, mmax, gamma, rand));
  
  
}
